Every once and a while my Supermemo collection gets to big and I have to delete my git history. Here is how to do that safely.


git checkout --orphan new-branch
git add -A
git commit -m "Initial commit"
git branch -D master
git branch -m master
git push -f origin master
"you might also need this"
git push --set-upstream origin master

What is happening here is we make a temporary branch of most recent commit. Delete the old branch which contains history. then make the temp branch our main branch.

the key command to making the temporary branch is

git checkout --orphan new-branch which makes a new branch without any commit history.